import { attrsTypeOptions, selectOptions } from '../options';
import { CreatedOptionsProps } from '@/views/basic/created/interface';

export const inputItem: CreatedOptionsProps[] = [
  {
    type: 'select',
    label: '密码框',
    prop: 'showPassword',
    hide: false,
    defaultValue: false,
    sort: 10000,
    children: selectOptions
  },
  {
    type: 'input',
    label: 'input方法',
    sort: 9900,
    prop: 'inputMethod',
    hide: false,
    attrs: {
      type: 'textarea'
    }
  },
  {
    type: 'input',
    label: '失去焦点方法',
    sort: 9800,
    prop: 'blurFunction',
    hide: false,
    attrs: {
      type: 'textarea'
    }
  },
  {
    type: 'input',
    label: '值改变方法',
    sort: 9700,
    prop: 'changeMethod',
    hide: false,
    attrs: {
      type: 'textarea'
    }
  },
  {
    type: 'select',
    label: '类型',
    sort: 18800,
    prop: 'attrs.type',
    hide: false,
    children: attrsTypeOptions,
    changeMethod: (form, itemForm) => {
      if (form['attrs.type'] === 'textarea') {
        form['attrs.style.width'] = '500px';
      } else {
        form['attrs.style.width'] = '';
      }
    }
  }
];
